home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / include / python2.5 / Imaging.h next >
C/C++ Source or Header  |  2008-06-24  |  19KB  |  496 lines

  1. /*
  2.  * The Python Imaging Library
  3.  * $Id: Imaging.h 2542 2005-10-02 21:37:20Z Fredrik $
  4.  * 
  5.  * declarations for the imaging core library
  6.  *
  7.  * Copyright (c) 1997-2005 by Secret Labs AB
  8.  * Copyright (c) 1995-2005 by Fredrik Lundh
  9.  *
  10.  * See the README file for information on usage and redistribution.
  11.  */
  12.  
  13.  
  14. #include "ImPlatform.h"
  15.  
  16.  
  17. #if defined(__cplusplus)
  18. extern "C" {
  19. #endif
  20.  
  21.  
  22. #ifndef M_PI
  23. #define    M_PI    3.14159265359
  24. #endif
  25.  
  26.  
  27. /* -------------------------------------------------------------------- */
  28.  
  29. /*
  30.  * Image data organization:
  31.  *
  32.  * mode        bytes    byte order
  33.  * -------------------------------
  34.  * 1        1        1
  35.  * L        1        L
  36.  * P        1        P
  37.  * I        4           I (32-bit integer, native byte order)
  38.  * F        4           F (32-bit IEEE float, native byte order)
  39.  * RGB        4        R, G, B, -
  40.  * RGBA        4        R, G, B, A
  41.  * CMYK        4        C, M, Y, K
  42.  * YCbCr    4        Y, Cb, Cr, -
  43.  *
  44.  * experimental modes (incomplete):
  45.  * LA       4           L, -, -, A
  46.  * PA       4           P, -, -, A
  47.  * I;16     2           I (16-bit integer, native byte order)
  48.  *
  49.  * "P" is an 8-bit palette mode, which should be mapped through the
  50.  * palette member to get an output image.  Check palette->mode to
  51.  * find the corresponding "real" mode.
  52.  *
  53.  * For information on how to access Imaging objects from your own C
  54.  * extensions, see http://www.effbot.org/zone/pil-extending.htm
  55.  */
  56.  
  57. /* Handles */
  58.  
  59. typedef struct ImagingMemoryInstance* Imaging;
  60. typedef struct ImagingAccessInstance* ImagingAccess;
  61. typedef struct ImagingHistogramInstance* ImagingHistogram;
  62. typedef struct ImagingOutlineInstance* ImagingOutline;
  63. typedef struct ImagingPaletteInstance* ImagingPalette;
  64.  
  65. /* handle magics (used with PyCObject). */
  66. #define IMAGING_MAGIC "PIL Imaging"
  67. #define IMAGING_ACCESS_MAGIC "PIL ImagingAccess"
  68.  
  69. /* pixel types */
  70. #define IMAGING_TYPE_UINT8 0
  71. #define IMAGING_TYPE_INT32 1
  72. #define IMAGING_TYPE_FLOAT32 2
  73. #define IMAGING_TYPE_SPECIAL 3 /* check mode for details */
  74.  
  75. struct ImagingMemoryInstance {
  76.  
  77.     /* Format */
  78.     char mode[4+1];    /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK") */
  79.     int type;        /* Data type (IMAGING_TYPE_*) */
  80.     int depth;        /* Depth (ignored in this version) */
  81.     int bands;        /* Number of bands (1, 2, 3, or 4) */
  82.     int xsize;        /* Image dimension. */
  83.     int ysize;
  84.  
  85.     /* Colour palette (for "P" images only) */
  86.     ImagingPalette palette;
  87.  
  88.     /* Data pointers */
  89.     UINT8 **image8;    /* Set for 8-bit images (pixelsize=1). */
  90.     INT32 **image32;    /* Set for 32-bit images (pixelsize=4). */
  91.  
  92.     /* Internals */
  93.     char **image;    /* Actual raster data. */
  94.     char *block;    /* Set if data is allocated in a single block. */
  95.  
  96.     int pixelsize;    /* Size of a pixel, in bytes (1, 2 or 4) */
  97.     int linesize;    /* Size of a line, in bytes (xsize * pixelsize) */
  98.  
  99.     /* Virtual methods */
  100.     void (*destroy)(Imaging im);
  101.  
  102. };
  103.  
  104.  
  105. #define IMAGING_PIXEL_1(im,x,y) ((im)->image8[(y)][(x)])
  106. #define IMAGING_PIXEL_L(im,x,y) ((im)->image8[(y)][(x)])
  107. #define IMAGING_PIXEL_LA(im,x,y) ((im)->image[(y)][(x)*4])
  108. #define IMAGING_PIXEL_P(im,x,y) ((im)->image8[(y)][(x)])
  109. #define IMAGING_PIXEL_PA(im,x,y) ((im)->image[(y)][(x)*4])
  110. #define IMAGING_PIXEL_I(im,x,y) ((im)->image32[(y)][(x)])
  111. #define IMAGING_PIXEL_F(im,x,y) (((FLOAT32*)(im)->image32[y])[x])
  112. #define IMAGING_PIXEL_RGB(im,x,y) ((im)->image[(y)][(x)*4])
  113. #define IMAGING_PIXEL_RGBA(im,x,y) ((im)->image[(y)][(x)*4])
  114. #define IMAGING_PIXEL_CMYK(im,x,y) ((im)->image[(y)][(x)*4])
  115. #define IMAGING_PIXEL_YCbCr(im,x,y) ((im)->image[(y)][(x)*4])
  116.  
  117. #define IMAGING_PIXEL_UINT8(im,x,y) ((im)->image8[(y)][(x)])
  118. #define IMAGING_PIXEL_INT32(im,x,y) ((im)->image32[(y)][(x)])
  119. #define IMAGING_PIXEL_FLOAT32(im,x,y) (((FLOAT32*)(im)->image32[y])[x])
  120.  
  121. #define IMAGING_ACCESS_HEAD\
  122.     int (*getline)(ImagingAccess access, char *buffer, int y);\
  123.     void (*destroy)(ImagingAccess access)
  124.  
  125. struct ImagingAccessInstance {
  126.     IMAGING_ACCESS_HEAD;
  127.  
  128.     /* Data members */
  129.     Imaging im;
  130.  
  131. };
  132.  
  133.  
  134. struct ImagingHistogramInstance {
  135.  
  136.     /* Format */
  137.     char mode[4+1];    /* Band names (of corresponding source image) */
  138.     int bands;        /* Number of bands (1, 3, or 4) */
  139.  
  140.     /* Data */
  141.     long *histogram;    /* Histogram (bands*256 longs) */
  142.  
  143. };
  144.  
  145.  
  146. struct ImagingPaletteInstance {
  147.  
  148.     /* Format */
  149.     char mode[4+1];    /* Band names */
  150.  
  151.     /* Data */
  152.     UINT8 palette[1024];/* Palette data (same format as image data) */
  153.  
  154.     INT16* cache;    /* Palette cache (used for predefined palettes) */
  155.     int keep_cache;    /* This palette will be reused; keep cache */
  156.  
  157. };
  158.  
  159.  
  160. /* Objects */
  161. /* ------- */
  162.  
  163. extern int ImagingNewCount;
  164.  
  165. extern Imaging ImagingNew(const char* mode, int xsize, int ysize);
  166. extern Imaging ImagingNew2(const char* mode, Imaging imOut, Imaging imIn);
  167. extern void    ImagingDelete(Imaging im);
  168.  
  169. extern Imaging ImagingNewBlock(const char* mode, int xsize, int ysize);
  170. extern Imaging ImagingNewArray(const char* mode, int xsize, int ysize);
  171. extern Imaging ImagingNewMap(const char* filename, int readonly,
  172.                              const char* mode, int xsize, int ysize);
  173.  
  174. extern Imaging ImagingNewPrologue(const char *mode,
  175.                                   unsigned xsize, unsigned ysize);
  176. extern Imaging ImagingNewPrologueSubtype(const char *mode,
  177.                                   unsigned xsize, unsigned ysize,
  178.                                   int structure_size);
  179. extern Imaging ImagingNewEpilogue(Imaging im);
  180.  
  181. extern void ImagingCopyInfo(Imaging destination, Imaging source);
  182.  
  183. extern void ImagingHistogramDelete(ImagingHistogram histogram);
  184.  
  185. extern ImagingAccess ImagingAccessNew(Imaging im);
  186. extern void          ImagingAccessDelete(ImagingAccess access);
  187.  
  188. extern ImagingPalette ImagingPaletteNew(const char *mode);
  189. extern ImagingPalette ImagingPaletteNewBrowser(void);
  190. extern ImagingPalette ImagingPaletteDuplicate(ImagingPalette palette);
  191. extern void           ImagingPaletteDelete(ImagingPalette palette);
  192.  
  193. extern int  ImagingPaletteCachePrepare(ImagingPalette palette);
  194. extern void ImagingPaletteCacheUpdate(ImagingPalette palette,
  195.                       int r, int g, int b);
  196. extern void ImagingPaletteCacheDelete(ImagingPalette palette);
  197.  
  198. #define    ImagingPaletteCache(p, r, g, b)\
  199.     p->cache[(r>>2) + (g>>2)*64 + (b>>2)*64*64]
  200.  
  201. extern Imaging ImagingQuantize(Imaging im, int colours, int mode, int kmeans);
  202.  
  203. /* Threading */
  204. /* --------- */
  205.  
  206. typedef void* ImagingSectionCookie;
  207.  
  208. extern void ImagingSectionEnter(ImagingSectionCookie* cookie);
  209. extern void ImagingSectionLeave(ImagingSectionCookie* cookie);
  210.  
  211. /* Exceptions */
  212. /* ---------- */
  213.  
  214. extern void* ImagingError_IOError(void);
  215. extern void* ImagingError_MemoryError(void);
  216. extern void* ImagingError_ModeError(void); /* maps to ValueError by default */
  217. extern void* ImagingError_Mismatch(void); /* maps to ValueError by default */
  218. extern void* ImagingError_ValueError(const char* message);
  219.  
  220. /* Transform callbacks */
  221. /* ------------------- */
  222.  
  223. /* standard transforms */
  224. #define IMAGING_TRANSFORM_AFFINE 0
  225. #define IMAGING_TRANSFORM_PERSPECTIVE 2
  226. #define IMAGING_TRANSFORM_QUAD 3
  227.  
  228.  
  229. /* standard filters */
  230. #define IMAGING_TRANSFORM_NEAREST 0
  231. #define IMAGING_TRANSFORM_ANTIALIAS 1
  232. #define IMAGING_TRANSFORM_BILINEAR 2
  233. #define IMAGING_TRANSFORM_BICUBIC 3
  234.  
  235. typedef int (*ImagingTransformMap)(double* X, double* Y,
  236.                                    int x, int y, void* data);
  237. typedef int (*ImagingTransformFilter)(void* out, Imaging im,
  238.                                       double x, double y,
  239.                                       void* data);
  240.  
  241. /* Image Manipulation Methods */
  242. /* -------------------------- */
  243.  
  244. extern Imaging ImagingBlend(Imaging imIn1, Imaging imIn2, float alpha);
  245. extern Imaging ImagingCopy(Imaging im);
  246. extern Imaging ImagingConvert(
  247.     Imaging im, const char* mode, ImagingPalette palette, int dither);
  248. extern Imaging ImagingConvertMatrix(Imaging im, const char *mode, float m[]);
  249. extern Imaging ImagingCrop(Imaging im, int x0, int y0, int x1, int y1);
  250. extern Imaging ImagingExpand(Imaging im, int x, int y, int mode);
  251. extern Imaging ImagingFill(Imaging im, const void* ink);
  252. extern int ImagingFill2(
  253.     Imaging into, const void* ink, Imaging mask,
  254.     int x0, int y0, int x1, int y1);
  255. extern Imaging ImagingFillBand(Imaging im, int band, int color);
  256. extern Imaging ImagingFillLinearGradient(const char* mode);
  257. extern Imaging ImagingFillRadialGradient(const char* mode);
  258. extern Imaging ImagingFilter(
  259.     Imaging im, int xsize, int ysize, const FLOAT32* kernel,
  260.     FLOAT32 offset, FLOAT32 divisor);
  261. extern Imaging ImagingFlipLeftRight(Imaging imOut, Imaging imIn);
  262. extern Imaging ImagingFlipTopBottom(Imaging imOut, Imaging imIn);
  263. extern Imaging ImagingGetBand(Imaging im, int band);
  264. extern int ImagingGetBBox(Imaging im, int bbox[4]);
  265. typedef struct { int x, y; INT32 count; INT32 pixel; } ImagingColorItem;
  266. extern ImagingColorItem* ImagingGetColors(Imaging im, int maxcolors,
  267.     int *colors);
  268. extern int ImagingGetExtrema(Imaging im, void *extrema);
  269. extern int ImagingGetProjection(Imaging im, UINT8* xproj, UINT8* yproj);
  270. extern ImagingHistogram ImagingGetHistogram(
  271.     Imaging im, Imaging mask, void *extrema);
  272. extern Imaging ImagingModeFilter(Imaging im, int size);
  273. extern Imaging ImagingNegative(Imaging im);
  274. extern Imaging ImagingOffset(Imaging im, int xoffset, int yoffset);
  275. extern int ImagingPaste(
  276.     Imaging into, Imaging im, Imaging mask,
  277.     int x0, int y0, int x1, int y1);
  278. extern Imaging ImagingPoint(
  279.     Imaging im, const char* tablemode, const void* table);
  280. extern Imaging ImagingPointTransform(
  281.     Imaging imIn, double scale, double offset);
  282. extern Imaging ImagingPutBand(Imaging im, Imaging imIn, int band);
  283. extern Imaging ImagingRankFilter(Imaging im, int size, int rank);
  284. extern Imaging ImagingResize(Imaging imOut, Imaging imIn, int filter);
  285. extern Imaging ImagingRotate(
  286.     Imaging imOut, Imaging imIn, double theta, int filter);
  287. extern Imaging ImagingRotate90(Imaging imOut, Imaging imIn);
  288. extern Imaging ImagingRotate180(Imaging imOut, Imaging imIn);
  289. extern Imaging ImagingRotate270(Imaging imOut, Imaging imIn);
  290. extern Imaging ImagingStretch(Imaging imOut, Imaging imIn, int filter);
  291. extern Imaging ImagingTransformPerspective(
  292.     Imaging imOut, Imaging imIn, int x0, int y0, int x1, int y1, 
  293.     double a[8], int filter, int fill);
  294. extern Imaging ImagingTransformAffine(
  295.     Imaging imOut, Imaging imIn, int x0, int y0, int x1, int y1, 
  296.     double a[6], int filter, int fill);
  297. extern Imaging ImagingTransformQuad(
  298.     Imaging imOut, Imaging imIn, int x0, int y0, int x1, int y1, 
  299.     double a[8], int filter, int fill);
  300. extern Imaging ImagingTransform(
  301.     Imaging imOut, Imaging imIn, int x0, int y0, int x1, int y1, 
  302.     ImagingTransformMap transform, void* transform_data,
  303.     ImagingTransformFilter filter, void* filter_data,
  304.     int fill);
  305. extern Imaging ImagingCopy2(Imaging imOut, Imaging imIn);
  306. extern Imaging ImagingConvert2(Imaging imOut, Imaging imIn);
  307.  
  308. /* Channel operations */
  309. /* any mode, except "F" */
  310. extern Imaging ImagingChopLighter(Imaging imIn1, Imaging imIn2);
  311. extern Imaging ImagingChopDarker(Imaging imIn1, Imaging imIn2);
  312. extern Imaging ImagingChopDifference(Imaging imIn1, Imaging imIn2);
  313. extern Imaging ImagingChopMultiply(Imaging imIn1, Imaging imIn2);
  314. extern Imaging ImagingChopScreen(Imaging imIn1, Imaging imIn2);
  315. extern Imaging ImagingChopAdd(
  316.     Imaging imIn1, Imaging imIn2, float scale, int offset);
  317. extern Imaging ImagingChopSubtract(
  318.     Imaging imIn1, Imaging imIn2, float scale, int offset);
  319. extern Imaging ImagingChopAddModulo(Imaging imIn1, Imaging imIn2);
  320. extern Imaging ImagingChopSubtractModulo(Imaging imIn1, Imaging imIn2);
  321.  
  322. /* "1" images only */
  323. extern Imaging ImagingChopAnd(Imaging imIn1, Imaging imIn2);
  324. extern Imaging ImagingChopOr(Imaging imIn1, Imaging imIn2);
  325. extern Imaging ImagingChopXor(Imaging imIn1, Imaging imIn2);
  326.  
  327. /* Image measurement */
  328. extern void ImagingCrack(Imaging im, int x0, int y0);
  329.  
  330. /* Graphics */
  331. struct ImagingAffineMatrixInstance {
  332.     float a[9];
  333. };
  334.  
  335. typedef struct ImagingAffineMatrixInstance *ImagingAffineMatrix;
  336.  
  337. extern int ImagingDrawArc(Imaging im, int x0, int y0, int x1, int y1,
  338.                           int start, int end, const void* ink, int op);
  339. extern int ImagingDrawBitmap(Imaging im, int x0, int y0, Imaging bitmap,
  340.                              const void* ink, int op);
  341. extern int ImagingDrawChord(Imaging im, int x0, int y0, int x1, int y1,
  342.                             int start, int end, const void* ink, int fill,
  343.                             int op);
  344. extern int ImagingDrawEllipse(Imaging im, int x0, int y0, int x1, int y1,
  345.                               const void* ink, int fill, int op);
  346. extern int ImagingDrawLine(Imaging im, int x0, int y0, int x1, int y1,
  347.                const void* ink, int op);
  348. extern int ImagingDrawWideLine(Imaging im, int x0, int y0, int x1, int y1,
  349.                                const void* ink, int width, int op);
  350. extern int ImagingDrawPieslice(Imaging im, int x0, int y0, int x1, int y1,
  351.                                int start, int end, const void* ink, int fill,
  352.                                int op);
  353. extern int ImagingDrawPoint(Imaging im, int x, int y, const void* ink, int op);
  354. extern int ImagingDrawPolygon(Imaging im, int points, int *xy,
  355.                   const void* ink, int fill, int op);
  356. extern int ImagingDrawRectangle(Imaging im, int x0, int y0, int x1, int y1,
  357.                 const void* ink, int fill, int op);
  358.  
  359. /* Level 2 graphics (WORK IN PROGRESS) */
  360. extern ImagingOutline ImagingOutlineNew(void);
  361. extern void ImagingOutlineDelete(ImagingOutline outline);
  362.  
  363. extern int ImagingDrawOutline(Imaging im, ImagingOutline outline,
  364.                               const void* ink, int fill, int op);
  365.  
  366. extern int ImagingOutlineMove(ImagingOutline outline, float x, float y);
  367. extern int ImagingOutlineLine(ImagingOutline outline, float x, float y);
  368. extern int ImagingOutlineCurve(ImagingOutline outline, float x1, float y1,
  369.                                 float x2, float y2, float x3, float y3);
  370. extern int ImagingOutlineTransform(ImagingOutline outline, double a[6]);
  371.                                    
  372. extern int ImagingOutlineClose(ImagingOutline outline);
  373.  
  374. /* Special effects */
  375. extern Imaging ImagingEffectSpread(Imaging imIn, int distance);
  376. extern Imaging ImagingEffectNoise(int xsize, int ysize, float sigma);
  377. extern Imaging ImagingEffectMandelbrot(int xsize, int ysize,
  378.                                        double extent[4], int quality);
  379.  
  380. /* Obsolete */
  381. extern int ImagingToString(Imaging im, int orientation, char *buffer);
  382. extern int ImagingFromString(Imaging im, int orientation, char *buffer);
  383.  
  384.  
  385. /* File I/O */
  386. /* -------- */
  387.  
  388. /* Built-in drivers */
  389. extern Imaging ImagingOpenPPM(const char* filename);
  390. extern int ImagingSavePPM(Imaging im, const char* filename);
  391.  
  392. /* Utility functions */
  393. extern UINT32 ImagingCRC32(UINT32 crc, UINT8* buffer, int bytes);
  394.  
  395. /* Codecs */
  396. typedef struct ImagingCodecStateInstance *ImagingCodecState;
  397. typedef int (*ImagingCodec)(Imaging im, ImagingCodecState state,
  398.                 UINT8* buffer, int bytes);
  399.  
  400. extern int ImagingBitDecode(Imaging im, ImagingCodecState state,
  401.                 UINT8* buffer, int bytes);
  402. extern int ImagingEpsEncode(Imaging im, ImagingCodecState state,
  403.                 UINT8* buffer, int bytes);
  404. extern int ImagingFliDecode(Imaging im, ImagingCodecState state,
  405.                 UINT8* buffer, int bytes);
  406. extern int ImagingGifDecode(Imaging im, ImagingCodecState state,
  407.                 UINT8* buffer, int bytes);
  408. extern int ImagingGifEncode(Imaging im, ImagingCodecState state,
  409.                 UINT8* buffer, int bytes);
  410. extern int ImagingHexDecode(Imaging im, ImagingCodecState state,
  411.                 UINT8* buffer, int bytes);
  412. #ifdef    HAVE_LIBJPEG
  413. extern int ImagingJpegDecode(Imaging im, ImagingCodecState state,
  414.                  UINT8* buffer, int bytes);
  415. extern int ImagingJpegEncode(Imaging im, ImagingCodecState state,
  416.                  UINT8* buffer, int bytes);
  417. #endif
  418. extern int ImagingLzwDecode(Imaging im, ImagingCodecState state,
  419.                 UINT8* buffer, int bytes);
  420. #ifdef    HAVE_LIBMPEG
  421. extern int ImagingMpegDecode(Imaging im, ImagingCodecState state,
  422.                  UINT8* buffer, int bytes);
  423. #endif
  424. extern int ImagingMspDecode(Imaging im, ImagingCodecState state,
  425.                 UINT8* buffer, int bytes);
  426. extern int ImagingPackbitsDecode(Imaging im, ImagingCodecState state,
  427.                  UINT8* buffer, int bytes);
  428. extern int ImagingPcdDecode(Imaging im, ImagingCodecState state,
  429.                 UINT8* buffer, int bytes);
  430. extern int ImagingPcxDecode(Imaging im, ImagingCodecState state,
  431.                 UINT8* buffer, int bytes);
  432. extern int ImagingPcxEncode(Imaging im, ImagingCodecState state,
  433.                 UINT8* buffer, int bytes);
  434. extern int ImagingRawDecode(Imaging im, ImagingCodecState state,
  435.                 UINT8* buffer, int bytes);
  436. extern int ImagingRawEncode(Imaging im, ImagingCodecState state,
  437.                 UINT8* buffer, int bytes);
  438. extern int ImagingSunRleDecode(Imaging im, ImagingCodecState state,
  439.                    UINT8* buffer, int bytes);
  440. extern int ImagingTgaRleDecode(Imaging im, ImagingCodecState state,
  441.                    UINT8* buffer, int bytes);
  442. extern int ImagingXbmDecode(Imaging im, ImagingCodecState state,
  443.                 UINT8* buffer, int bytes);
  444. extern int ImagingXbmEncode(Imaging im, ImagingCodecState state,
  445.                 UINT8* buffer, int bytes);
  446. #ifdef    HAVE_LIBZ
  447. extern int ImagingZipDecode(Imaging im, ImagingCodecState state,
  448.                 UINT8* buffer, int bytes);
  449. extern int ImagingZipEncode(Imaging im, ImagingCodecState state,
  450.                 UINT8* buffer, int bytes);
  451. #endif
  452.  
  453. typedef void (*ImagingShuffler)(UINT8* out, const UINT8* in, int pixels);
  454.  
  455. /* Public shufflers */
  456. extern void ImagingPackRGB(UINT8* out, const UINT8* in, int pixels);
  457. extern void ImagingPackBGR(UINT8* out, const UINT8* in, int pixels);
  458. extern void ImagingUnpackRGB(UINT8* out, const UINT8* in, int pixels);
  459. extern void ImagingUnpackBGR(UINT8* out, const UINT8* in, int pixels);
  460. extern void ImagingUnpackYCC(UINT8* out, const UINT8* in, int pixels);
  461. extern void ImagingUnpackYCCA(UINT8* out, const UINT8* in, int pixels);
  462. extern void ImagingUnpackYCbCr(UINT8* out, const UINT8* in, int pixels);
  463.  
  464. extern void ImagingConvertRGB2YCbCr(UINT8* out, const UINT8* in, int pixels);
  465. extern void ImagingConvertYCbCr2RGB(UINT8* out, const UINT8* in, int pixels);
  466.  
  467. extern ImagingShuffler ImagingFindUnpacker(const char* mode,
  468.                                            const char* rawmode, int* bits_out);
  469. extern ImagingShuffler ImagingFindPacker(const char* mode,
  470.                                          const char* rawmode, int* bits_out);
  471.  
  472. struct ImagingCodecStateInstance {
  473.     int count;
  474.     int state;
  475.     int errcode;
  476.     int x, y;
  477.     int ystep;
  478.     int xsize, ysize, xoff, yoff;
  479.     ImagingShuffler shuffle;
  480.     int bits, bytes;
  481.     UINT8 *buffer;
  482.     void *context;
  483. };
  484.  
  485. /* Errcodes */
  486. #define    IMAGING_CODEC_END     1
  487. #define    IMAGING_CODEC_OVERRUN    -1
  488. #define    IMAGING_CODEC_BROKEN    -2
  489. #define    IMAGING_CODEC_UNKNOWN    -3
  490. #define    IMAGING_CODEC_CONFIG    -8
  491. #define    IMAGING_CODEC_MEMORY    -9
  492.  
  493. #if defined(__cplusplus)
  494. }
  495. #endif
  496.